package com.lgl.study.mqtt.controller;

import com.lgl.study.mqtt.service.MqttGateway;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {
 
    private final MqttGateway mqttGateway;

    @Autowired
    public TestController(MqttGateway mqttGateway) {
        this.mqttGateway = mqttGateway;
    }

    @RequestMapping("/send")
    public String sendMqtt(String  sendData){
        mqttGateway.sendToMqtt(sendData,"windows");
        mqttGateway.sendToMqtt(sendData);
        return "success";
    }
}